package com.mall.controller;


import com.mall.common.pojo.TaotaoResult;
import com.mall.pojo.EUDataGridResult;
import com.mall.pojo.TbItemParam;
import com.mall.service.ItemParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/item/param")
public class ItemParamController {

    @Autowired
    private ItemParamService itemParamService;

    @RequestMapping("/query/itemcatid/{itemCatId}")
    @ResponseBody
    public TaotaoResult getItemParamById(@PathVariable Long itemCatId){

        TaotaoResult result=itemParamService.getItemParamByCid(itemCatId);
        return result;
    }


    @RequestMapping("/save/{cid}")
    @ResponseBody
    public TaotaoResult insertItemParam(@PathVariable Long cid,String paramData){

        TbItemParam itemParam=new TbItemParam();
        itemParam.setItemCatId(cid);
        itemParam.setParamData(paramData);
        TaotaoResult result=itemParamService.insertItemParam(itemParam);
        return result;
    }

    @RequestMapping("/list")
    @ResponseBody
    public EUDataGridResult getItemParamList(Integer page,Integer rows){
        EUDataGridResult result=itemParamService.getItemParamList(page,rows);
        return result;
    }

}
